global._ = require('lodash')
global.APP_PATH = process.cwd()
global.path = require('path')
global.fs = require('fs')
global.configure = require('little-man-config')
global.pager = require('../../framework/lib/pager')
global.log4js = require('../../framework/lib/log4js')
global.helper = require('../../framework/lib/helper')
global.moment = require('moment')


const apiFree = require('api-free')                             // 载入api-free 核心组件

global.M = apiFree.M
global.DB = apiFree.DB
global.dbUtil = apiFree.dbUtil

// 初始化 api-free
apiFree.init(configure.get('apifree')).then(async ()=>{
    await dbUtil.createOrUpdate('user_account',{id: 'admin'},{
        id: 'admin',
        account: 'admin',
        password: 'c3284d0f94606de1fd2af172aba15bf3',
        avatar: '',
        nickname: 'admin',
        user_type: 0,
    })

    log4js.debug('DONE !!!')
    process.exit(0);
}).catch(err => {
    log4js.error(err)
})






